package org.budo.support.spring.data.redis.connection.jedis;

import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.connection.jedis.JedisConnection;

import lombok.extern.slf4j.Slf4j;
import redis.clients.jedis.Jedis;

/**
 * @author lmw
 */
@Slf4j
public class BudoJedisConnection extends JedisConnection {
    private RedisConnectionFactory redisConnectionFactory;

    public BudoJedisConnection(Jedis jedis, RedisConnectionFactory redisConnectionFactory) {
        super(jedis);

        this.redisConnectionFactory = redisConnectionFactory;
    }

    @Override
    public byte[] get(byte[] key) {
        try {
            return super.get(key);
        } catch (RuntimeException e) {
            log.error("#27 get error, redisConnectionFactory=" + this.redisConnectionFactory + ", e=" + e, e);
            throw e;
        }
    }
}